import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '合同编号',
    align:"center",
    dataIndex: 'ph'
   },
  {
    title: '合同编号',
    align:"center",
    dataIndex: 'qymc'
  },
   {
    title: '序号',
    align:"center",
    dataIndex: 'cnt'
   },
   {
    title: '付款日期',
    align:"center",
    dataIndex: 'fkrq',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '工人行政费',
    align:"center",
    dataIndex: 'grgl'
   },
   {
    title: '工人行政费币种',
    align:"center",
    dataIndex: 'pz1'
   },
   {
    title: '工厂综合费',
    align:"center",
    dataIndex: 'cfgl'
   },
   {
    title: '计费面积M',
    align:"center",
    dataIndex: 'jfmj'
   },
   {
    title: '工厂综合费币种',
    align:"center",
    dataIndex: 'pz2'
   },
   {
    title: '外汇补差',
    align:"center",
    dataIndex: 'ttgl'
   },
   {
    title: '计算标准',
    align:"center",
    dataIndex: 'jsbz'
   },
   {
    title: '计费面积M',
    align:"center",
    dataIndex: 'jfmj2'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'pz'
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "合同编号",
      field: 'ph',
      component: 'JInput',
      colProps: {span: 6},
 	},
  {
    label: "企业名称",
    field: 'qymc',
    component: 'JInput',
    colProps: {span: 6},
  },
     {
      label: "付款日期",
      field: "fkrq",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
      },
      colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '合同编号',
    field: 'ph',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入合同编号!'},
          ];
     },
  },
  {
    label: '序号',
    field: 'cnt',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入序号!'},
          ];
     },
  },
  {
    label: '付款日期',
    field: 'fkrq',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入付款日期!'},
          ];
     },
  },
  {
    label: '工人行政费',
    field: 'grgl',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入工人行政费!'},
          ];
     },
  },
  {
    label: '工人行政费币种',
    field: 'pz1',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入工人行政费币种!'},
          ];
     },
  },
  {
    label: '工厂综合费',
    field: 'cfgl',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入工厂综合费!'},
          ];
     },
  },
  {
    label: '计费面积M',
    field: 'jfmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入计费面积M!'},
          ];
     },
  },
  {
    label: '工厂综合费币种',
    field: 'pz2',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:'money_type'
    },
    defaultValue:'人民币',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入工厂综合费币种!'},
          ];
     },
  },
  {
    label: '外汇补差',
    field: 'ttgl',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入外汇补差!'},
          ];
     },
  },
  {
    label: '计算标准',
    field: 'jsbz',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入计算标准!'},
          ];
     },
  },
  {
    label: '计费面积M',
    field: 'jfmj2',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入计费面积M!'},
          ];
     },
  },
  {
    label: '备注',
    field: 'pz',
    component: 'InputTextArea',
  },

	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
